﻿<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="WebRoot._Default" %>
<%@ MasterType VirtualPath="~/Site.Master" %>

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">

    <asp:UpdatePanel ID="ApplyPayment_AjaxPanel" runat="server"
        UpdateMode="Conditional" ChildrenAsTriggers="false">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="BillSummary" EventName="ItemCommand" />
        </Triggers>
        <ContentTemplate>
            <aspext:ModalPopupExtender ID="ApplyPayment_PopupExtender" runat="server"
                Drag="true" DropShadow="true" RepositionMode="RepositionOnWindowResizeAndScroll"
                OkControlID="SavePayment" CancelControlID="CancelButton" PopupDragHandleControlID="DragHandle"
                PopupControlID="ApplyPayment_PopupPanel" TargetControlID="PopupTrigger" BackgroundCssClass="fadedBackground">
            </aspext:ModalPopupExtender>

            <asp:Button ID="PopupTrigger" runat="server"
                Text="PopupTrigger" Style="display:none;" />

            <asp:Panel ID="ApplyPayment_PopupPanel" runat="server"
                CssClass="popupPanel">
                <asp:Panel ID="DragHandle" runat="server"
                    CssClass="dragHandle">
                    Make a payment to <asp:Literal ID="PaymentTo" runat="server" />
                </asp:Panel>
                <fieldset style="margin:0;">
                    <asp:Label ID="lblAmountPaid" runat="server"
                        AssociatedControlID="AmountPaid" Width="100px"
                        Text="Amount Paid:" />
                    <asp:TextBox ID="AmountPaid" runat="server"
                        Width="100px" />

                    <asp:Label ID="lblPaymentAccount" runat="server"
                        AssociatedControlID="PaymentAccount" Width="120px"
                        Text="Paid From:" />
                    <asp:DropDownList ID="PaymentAccount" runat="server"
                        Width="179px" />

                    <br clear="all" />

                    <asp:Label ID="lblPaymentDate" runat="server"
                        AssociatedControlID="PaymentDate" Width="100px"
                        Text="Payment Date:" />
                    <asp:TextBox ID="PaymentDate" runat="server"
                        Width="100px" />

                    <asp:Label ID="lblConfirmationNumber" runat="server"
                        AssociatedControlID="ConfirmationNumber" Width="120px"
                        Text="Confirmation #:" />
                    <asp:TextBox ID="ConfirmationNumber" runat="server"
                        Width="175px" />

                    <br clear="all" />
                    <br clear="all" />

                    <asp:Label ID="lblNotes" runat="server"
                        AssociatedControlID="Notes" Width="100px"
                        Text="Notes:" />

                    <asp:TextBox ID="Notes" runat="server"
                        Width="401px" Height="75px" TextMode="MultiLine" />

                    <br clear="all" />

                    <asp:Button ID="SavePayment" runat="server"
                        Text="Save" OnClick="SavePayment_Click" />

                    <asp:Button ID="CancelButton" runat="server"
                        Text="Cancel" />

                </fieldset>           
            </asp:Panel>

        </ContentTemplate>    
    </asp:UpdatePanel>

    <asp:ListView ID="BillSummary" runat="server"
        OnItemDataBound="BillSummary_ItemDataBound"
        OnItemCommand="BillSummary_ItemCommand">
        <LayoutTemplate>
            <table class="billSummary" width="100%" cellpadding="0" cellspacing="0">
                <thead>
                    <tr>
                        <th style="width:25%;">Payee</th>
                        <th style="width:20%;">Amount Due</th>
                        <th style="width:20%;">Balance</th>
                        <th style="width:15%;">Last Payment</th>
                        <th style="width:15%;">Next Payment</th>
                        <th style="width:5%;"></th>
                    </tr>
                </thead>
                <tbody>
                    <asp:PlaceHolder ID="itemPlaceHolder" runat="server" />
                </tbody>
            </table>
        </LayoutTemplate>
        <ItemTemplate>
            <tr>
                <td style="padding-left:10px;"><asp:Literal ID="Payee" runat="server" /></td>
                <td><asp:Literal ID="AmountDue" runat="server" /></td>
                <td><asp:Literal ID="Balance" runat="server" /></td>
                <td><asp:Literal ID="LastPayment" runat="server" /></td>
                <td><asp:Literal ID="NextPayment" runat="server" /></td>
                <td>
                    <asp:ImageButton ID="PayButton" runat="server"
                        CommandName="ApplyPayment" ImageAlign="Middle"
                        ImageUrl="~/Images/Icons/ApplyPayment.png" />
                </td>
            </tr>
        </ItemTemplate>
    </asp:ListView>
</asp:Content>
